//pack11jsclass

var TablePropertiesPopup = new tablePropertiesPopup();

function tablePropertiesPopup() {

    this.initialized=false;
    this.element=document.getElementById("PopupBody");
    this.form=document.getElementById("PopupBody");
    this.extra=document.getElementById("PopupBody");
    this.changedElements=new Array();

    this.open = function() {
        if(!this.initialized) this.init();
        if(!this.initialized) return;
        this.changedElements=new Array();
        this.element.style.display="block";
        PopupManager.container.style.display="block";
        PopupManager.currentPopup=this;
        PopupManager.popupActive=true;
    }

    this.init = function() {
        try {
            this.element=document.getElementById("TablePropertiesPopup");
            this.form=document.getElementById("TablePropertiesForm");
            this.extra=document.getElementById("TablePropertiesForm_extra");
        } catch(e) {
            Trace("Could not find TablePropertiesPopup");
            return;
        }

        buttons=this.element.getElementsByTagName("input");
        for(tpb=0; tpb<buttons.length; tpb++) {
            button=buttons[tpb];
            if(button.id=="TablePropertiesSubmit") {
                button.onclick=this.submit;
            }

            if(button.id=="TablePropertiesCancel") {
                button.onclick=function() {
                PopupManager.close();
                }
            }
        }
        this.initialized=true;
    }

    this.submit = function() {
        try {
            searchStatus=document.getElementById("SearchForm_extra").value;
            if(searchStatus==1) {
                PostData.release(TablePropertiesPopup.form.action,TablePropertiesPopup.changedElements);
            } else {
                if(TablePropertiesPopup.changedElements.length>0) {
                    TablePropertiesPopup.form.submit();
                } else {
                    PopupManager.close();
                }
            }
        } catch(e) {
            Trace(e);
        }
    }

    this.setShowPrice=function(element,submit) {
        //alert("setShowPrice");
        spHidden=document.getElementById("TablePropertiesForm_showPrice_checkbox_value");
        spHidden.value=(element.checked==true)? 1:0;
        TablePropertiesPopup.changedElements.push(spHidden);
        if(submit) {
            this.init();
            this.submit();
        }
    }

    this.setCurrency=function(element,submit) {
        TablePropertiesPopup.changedElements.push(element);
        if(submit) {
            this.init();
            document.getElementById("TablePropertiesForm_currency_select").value=element.value;
            this.submit();
        }
    }
	
}